fix: prevent Flexible wrapping on shrink-0 children in justify-between rows#47
Merged
anilcancakir merged 2 commits intov1from Mar 31, 2026
Merged
Conversation
…n rows (#45) Container-level wrapping logic incorrectly wrapped all non-flex children with Flexible when using justify-between, breaking space distribution when combined with flex-1. Add _hasShrinkZero check to skip wrapping shrink-0 children and remove incorrect shrink-0 → FlexFit.tight parser mapping — shrink-0 now correctly preserves intrinsic size.
There was a problem hiding this comment.
Pull request overview
Fixes an issue where justify-between rows with a flex-1 child would distribute space incorrectly because non-flex children were being wrapped in Flexible, and updates shrink-0 semantics accordingly.
Changes:
- Updated
WDivRow child-wrapping logic to skipFlexiblewrapping forshrink-0children when space distribution/overflow logic is enabled. - Removed the
shrink-0 -> FlexFit.tightmapping soshrink-0no longer setsflexFit. - Updated docs/changelog and adjusted/added tests to reflect the corrected behavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
lib/src/widgets/w_div.dart |
Skips container-level Flexible wrapping for shrink-0 children in Row builds. |
lib/src/parser/parsers/flexbox_grid_parser.dart |
Removes shrink-0 from _flexFitMap so it no longer sets flexFit. |
test/widgets/w_div/flex_shrink_test.dart |
Adds widget tests asserting shrink-0 children aren’t wrapped with Flexible under justify-between. |
test/parser/parsers/flexbox_grid_parser_test.dart |
Updates expectations so shrink-0 does not set flexFit and adjusts override assertions. |
doc/layout/flexbox.md |
Updates documentation to state shrink-0 preserves intrinsic size with no wrapper. |
CHANGELOG.md |
Adds unreleased bug-fix entries for #45. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…erBox assertion - _hasShrinkZero now tokenizes by whitespace and matches full tokens (bare shrink-0 and prefixed variants like md:shrink-0) - Removed duplicate shrink-0 parser test - Widget test now verifies intrinsic size via RenderBox instead of re-checking Flexible wrapping
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #45 —
flex-1+justify-betweenspace distribution broken by incorrectFlexiblewrapping in Row._hasShrinkZerocheck to skipFlexiblewrapping forshrink-0children in container-level Row wrapping logic (w_div.dart)shrink-0 → FlexFit.tightmapping from_flexFitMap(flexbox_grid_parser.dart) —shrink-0now correctly preserves intrinsic size with no wrappershrink-0semanticsTest plan
flex-row justify-between+flex-1+shrink-0child not wrappedshrink-0does not setflexFitdart analyze: zero issues